<?php
declare (strict_types = 1);

namespace app\frontend\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class Requirement extends Model
{
    // 获取器
    public function getStatusAttr($value, $data)
    {
        $status = [1=>'规划中',2=>'实现中',3=>'已拒绝',4=>'已完成'];
        return $status[$value];
    }

    public function getPriorityAttr($value, $data)
    {
        $priority = [1=>'低', 2=>'中', 3=>'高'];
        return $priority[$value];
    }

    // 模型关联
    public function project()
    {
        return $this->belongsTo(Project::class);
    }

    public function requirementContent()
    {
        return $this->hasOne(RequirementContent::class);
    }
}
